#include "stdafx.h"
#include "CppUnitTest.h"

#include <HSmodel/HeightMap.h>

using namespace Microsoft::VisualStudio::CppUnitTestFramework;

namespace HSModelTests
{		
	TEST_CLASS(HeightMapTest)
	{
	public:
		
		TEST_METHOD(ShouldReturnMapDimensions)
		{
    // Arrange
    auto hm = HeightMap(5, 7);
    size_t x_size_expected = 5;
    size_t y_size_expected = 7;

    // Act
    auto x_size_actual = hm.GetSizeX();
    auto y_size_actual = hm.GetSizeY();

    // Assert
    Assert::AreEqual(x_size_expected, x_size_actual);
    Assert::AreEqual(y_size_expected, y_size_actual);
		}

    TEST_METHOD(ShouldGetRightValue)
		{
    // Arrange
    auto hm = HeightMap(3, 4);
    double expected = 0.0;

    // Act
    auto actual = hm.Get(1, 2);

    // Assert
    Assert::AreEqual(expected, actual);
		}

    TEST_METHOD(ShouldSetValue)
		{
    // Arrange
    auto hm = HeightMap(3, 4);
    auto expected = 5.2;

    // Act
    hm.Set(2, 2, 5.2);
    auto actual = hm.Get(2, 2); 
    auto neighbour = hm.Get(3, 2);

    // Assert
    Assert::AreEqual(expected, actual);
    Assert::AreEqual(neighbour, 0.0);
		}

	};
}